<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class CarModelDisplacement extends Model
{

    /**
     * 关联到模型排量的数据表
     *
     * @var string
     */
    protected $table = 'car_model_displacement';

    public static function modelDisplacement( $factory_name, $model_name ){

        $sql = "select * from car_model_displacement cmd left join car_model cm on cm.id=cmd.model_id "
            . " where cm.factory_name=? and cm.name=? ";
        $data = DB::select( $sql, [ $factory_name, $model_name ] );
        return $data;
    }
}